﻿CREATE TABLE [dbo].[DETALLE_GUIA_ENTRADA](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[IdGuiaEntrada] [int] NOT NULL,
	[IdProducto] [int] NOT NULL,
	[Cantidad] [int] NOT NULL,
	[ValorUnitario] [decimal](18, 2) NOT NULL,
 CONSTRAINT [PK_dbo.DETALLE_GUIA_ENTRADA] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [FK_dbo.DETALLE_GUIA_ENTRADA_dbo.GUIA_ENTRADA_IdGuiaEntrada]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[DETALLE_GUIA_ENTRADA]  WITH CHECK ADD  CONSTRAINT [FK_dbo.DETALLE_GUIA_ENTRADA_dbo.GUIA_ENTRADA_IdGuiaEntrada] FOREIGN KEY([IdGuiaEntrada])
REFERENCES [dbo].[GUIA_ENTRADA] ([ID])
GO

ALTER TABLE [dbo].[DETALLE_GUIA_ENTRADA] CHECK CONSTRAINT [FK_dbo.DETALLE_GUIA_ENTRADA_dbo.GUIA_ENTRADA_IdGuiaEntrada]
GO
/****** Object:  ForeignKey [FK_dbo.DETALLE_GUIA_ENTRADA_dbo.PRODUCTO_IdProducto]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[DETALLE_GUIA_ENTRADA]  WITH CHECK ADD  CONSTRAINT [FK_dbo.DETALLE_GUIA_ENTRADA_dbo.PRODUCTO_IdProducto] FOREIGN KEY([IdProducto])
REFERENCES [dbo].[PRODUCTO] ([ID])
GO

ALTER TABLE [dbo].[DETALLE_GUIA_ENTRADA] CHECK CONSTRAINT [FK_dbo.DETALLE_GUIA_ENTRADA_dbo.PRODUCTO_IdProducto]
GO
CREATE NONCLUSTERED INDEX [IX_IdGuiaEntrada] ON [dbo].[DETALLE_GUIA_ENTRADA] 
(
	[IdGuiaEntrada] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_IdProducto] ON [dbo].[DETALLE_GUIA_ENTRADA] 
(
	[IdProducto] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]